package com.huangpf.util.excelUtil;

import org.dom4j.Document;
import org.dom4j.Element;

import java.util.List;

/**
 * Created by huangpf on 2016/9/1.
 */
public class ExcelXml {
    private Element root;

    private Element sheetElement;

    private Element headerElement;

    private List<Element> cellElements;

    private boolean hasHeader = false;

    public ExcelXml(Document document){
        this.root = document.getRootElement();
        this.sheetElement = root.element("sheet");
        this.headerElement = sheetElement.element("header");
        this.cellElements = headerElement.elements("cell");

        if (headerElement != null){
            hasHeader = "true".equals(headerElement.attributeValue("isshow"));
        }
    }

    public Element getRoot() {
        return root;
    }

    public void setRoot(Element root) {
        this.root = root;
    }

    public Element getSheetElement() {
        return sheetElement;
    }

    public void setSheetElement(Element sheetElement) {
        this.sheetElement = sheetElement;
    }

    public Element getHeaderElement() {
        return headerElement;
    }

    public void setHeaderElement(Element headerElement) {
        this.headerElement = headerElement;
    }

    public List<Element> getCellElements() {
        return cellElements;
    }

    public void setCellElements(List<Element> cellElements) {
        this.cellElements = cellElements;
    }

    public boolean isHasHeader() {
        return hasHeader;
    }

    public void setHasHeader(boolean hasHeader) {
        this.hasHeader = hasHeader;
    }
}
